/**
 * \file CArticleFrm.h
 * \author Corentin Le Bail
 * \date 2009-2011
 * \brief Fichier de déclaration de la classe CArticleFrm; fenêtre des fiches article.
 */
//------------------------------------------------------------------------------
#ifndef __CARTICLEFRM_H__
#define __CARTICLEFRM_H__
//------------------------------------------------------------------------------
#include "CMyMainWindow.h"
#include "ui_CArticleFrm.h"
#include "CGrilleWidget.h"
//------------------------------------------------------------------------------
/**
 * \class CArticleFrm CArticleFrm.h "CArticleFrm.h"
 * \brief Classe de la fenêtre des fiches article
 */
class CArticleFrm : public CMyMainWindow, private Ui::ArticleFrm
{
	Q_OBJECT
	public:
		/**
	 	 * \fn CArticleFrm(QString name, QString lastCode, QWidget *parent = 0)
		 * \brief Constructeur
		 * \param[in] name Nom de l'objet
	 	 * \param[in] lastCode Dernier article affiché
		 * \param[in] parent Référence vers un objet parent
		 */
		CArticleFrm(QString name, QString lastCode, QWidget *parent = 0);
	private:
		enum {cnvCClient, cnvClient, cnvNbL, cnvQte, cnvMnt} EColVentesArticles;
		enum {cnmsDate, cnmsStockAv, cnmsMv, cmnsStockApres, cmnsBL, cnmsLigneBL} EColMvtStockArticles;
		
		CGlobal::EAction actionCur;
		CGrilleWidget *ventesWidget;
		CGrilleWidget *mvtStockWidget;
	
		void setActionCur(CGlobal::EAction action);
		CGlobal::EAction getActionCur(void); 
		void closeEvent(QCloseEvent * event);
		void resizeEvent(QResizeEvent * event);
		void createGrilleVentes(void);
		void loadGrilleVentes(QString filter="");
		void createGrilleMvtStock(void);
		void loadGrilleMvtStock(void);
		void makeRequete(QString &requete, QString &alias);
		void showFormulaire(QSqlQuery *query, CGlobal::EAction& action);
	private slots:
		void on_actAjouter_triggered(void);
		void on_actValider_triggered(void);
		void on_actAnnuler_triggered(void);
		void on_actSupprimer_triggered(void);
		void onChange(void);
		void on_actRechercheUneFiche_triggered(void);
		void on_actEntreesSorties_triggered(void);
		void onCombo(CMyComboBox *comboBox);
		void onInvokeHelp(CChamp *champ);
		void filterVentes(QString filtre);
		void onChangeTva(void);
};
//------------------------------------------------------------------------------
#endif //__CARTICLEFRM_H__
//------------------------------------------------------------------------------